package com.joolun.weixin.service.impl;

import java.util.List;

import com.joolun.common.corp.TenantContext;
import com.joolun.common.utils.DateUtils;
import com.joolun.weixin.mapper.ScrmJobGroupMapper;
import com.joolun.weixin.service.IScrmJobGroupService;
import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;
import com.joolun.system.domain.ScrmJobGroup;

/**
 * 职能分组Service业务层处理
 * 
 * @author joolun
 * @date 2025-03-06
 */
@Service
public class ScrmJobGroupServiceImpl extends  ServiceImpl<ScrmJobGroupMapper, ScrmJobGroup> implements IScrmJobGroupService
{
    @Autowired
    private ScrmJobGroupMapper scrmJobGroupMapper;

    /**
     * 查询职能分组
     * 
     * @param id 职能分组主键
     * @return 职能分组
     */
    @Override
    public ScrmJobGroup selectScrmJobGroupById(Long id)
    {
        return scrmJobGroupMapper.selectScrmJobGroupById(id);
    }

    /**
     * 查询职能分组列表
     * 
     * @param scrmJobGroup 职能分组
     * @return 职能分组
     */
    @Override
    public List<ScrmJobGroup> selectScrmJobGroupList(ScrmJobGroup scrmJobGroup)
    {
        // 添加主体id
        scrmJobGroup.setCorpId(TenantContext.getTenantId());
        return scrmJobGroupMapper.selectScrmJobGroupList(scrmJobGroup);
    }

    /**
     * 新增职能分组
     * 
     * @param scrmJobGroup 职能分组
     * @return 结果
     */
    @Override
    public int insertScrmJobGroup(ScrmJobGroup scrmJobGroup)
    {
        // 添加主体id
        scrmJobGroup.setCorpId(TenantContext.getTenantId());
        scrmJobGroup.setCreateTime(DateUtils.getNowDate());
        return scrmJobGroupMapper.insertScrmJobGroup(scrmJobGroup);
    }

    /**
     * 修改职能分组
     * 
     * @param scrmJobGroup 职能分组
     * @return 结果
     */
    @Override
    public int updateScrmJobGroup(ScrmJobGroup scrmJobGroup)
    {
        scrmJobGroup.setUpdateTime(DateUtils.getNowDate());
        return scrmJobGroupMapper.updateScrmJobGroup(scrmJobGroup);
    }

    /**
     * 批量删除职能分组
     * 
     * @param ids 需要删除的职能分组主键
     * @return 结果
     */
    @Override
    public int deleteScrmJobGroupByIds(Long[] ids)
    {
        return scrmJobGroupMapper.deleteScrmJobGroupByIds(ids);
    }

    /**
     * 删除职能分组信息
     * 
     * @param id 职能分组主键
     * @return 结果
     */
    @Override
    public int deleteScrmJobGroupById(Long id)
    {
        return scrmJobGroupMapper.deleteScrmJobGroupById(id);
    }
}
